import Vue from 'vue'
import VueRouter from 'vue-router'

// 1.安装插件
Vue.use(VueRouter)

const routes = [
		{
			path:'/',
			redirect:'/home'
		},
		{
			path:'/home',
			meta:{
				title:'首页'
			},
			component: () => import('@/views/home/Home')
		},
		{
			path:'/category',
			meta:{
				title:'分类'
			},
			component: () => import('@/views/category/Category')
		},
		{
			path:'/cart',
			meta:{
				title:'购物车'
			},
			component: () => import('@/views/cart/Cart')
		},
		{
			path:'/profile',
			meta:{
				title:'个人中心'
			},
			component: () => import('@/views/profile/Profile')
		},
    {
      path: '/detail/:merchantId/:productId',
      meta:{
        title:'详情'
      },
      component:() => import('@/views/detail/Detail')
    }
]

// 2.创建router
const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
